<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/public/header.jsp"%>
<%
    String callback = request.getParameter("callback");
    String id = request.getParameter("id") == null ? "" : request.getParameter("id");
    boolean isAdd = "".equals(id);
    int flag = 0;
    if(!isAdd){
    	flag = 1;
    }
%>

<html>
	<head>
		<title><%=isAdd?"新建公司银行卡":"编辑公司银行卡" %></title>
		<style>
			.td1{
				padding-top:10px;
				padding-bottom:5px;
				font-size: 12px;
				background-color: #c0ebd7;
				width:20%;
			}
			.td2{
				padding:5px;
			}
			.tdg{
			padding-top:10px;
			padding-bottom:5px;
			font-size: 12px;
			background-color: #c0ebd7;
			width:20%;
		}
		.tdb{
			padding:5px;
			width:30%;
		}
		</style>
	</head>
	<script type="text/javascript">	
		$(function(){
			if('1' == '<%=flag%>'){
				$('#ff').form('load','<%=contextPath%>/springMVC/finance/getFinanceCompanyById?id=<%=id%>');
				$('#money').numberbox('disable');
			}
		});
		function doSubmit(obj){
		 if($('#ff').form('validate')){
		 	$(obj).hide();
			$('#ff').form('submit',{
				<%=isAdd?"url:'"+contextPath+"/springMVC/finance/addFinanceCompany',":"url:'"+contextPath+"/springMVC/finance/updateFinanceCompany?id="+id+"',"%>
				success: function(data){
					  var rtJson = eval('(' + data + ')');
					  if(rtJson.rtState == '0'){
							eval('window.opener.rtCallBack();');
							window.close();
						}
						else{
							$.messager.alert("提示",rtJson.rtMsrg);
						}
						$(obj).show();
				  }
			});
		 }
		}
	</script>
	<body>
	<div style="width: 90%;padding-left:50px">
		<form id="ff" method="POST">
		<table  style="border-collapse: collapse;" width="100%" border="1px" bordercolor="#0eb83a">
				<tr>
					<td align="right"  nowrap class="td1">
						银行：
					</td>
					<td class="td2" nowrap>
						<input  id="bank" name="bank"  class="easyui-validatebox" data-options="required:true">
					</td>
					<td align="right" nowrap class="td1">
						账号：
					</td>
					<td class="td2" nowrap>
						<input  id="account" name="account"  class="easyui-validatebox" data-options="required:true">
					</td>
				</tr>
				<tr>
				<td align="right"  class="td1" nowrap>
						开户人：
					</td>
					<td  class="td2" nowrap>
						<input type="text" id="owner" name="owner" >
					</td>
					<td align="right" nowrap class="td1">
						金额：
					</td>
					<td class="td2" nowrap>
						<input type="text" id="money" name="money" class="easyui-numberbox" value='0' data-options="required:true,min:0,precision:2"/>
					</td>
				</tr>
   				<tr>
   					<td align="right"  class="td1" nowrap></td>
					<td colspan="3" style="padding-left:10px;padding-top:5px;padding-bottom:5px;">
						<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:false" onclick="doSubmit(this);">保存</a>
						<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:false" onclick="javascript:window.close();">关闭</a>
					</td>
				</tr>
 			</table>
		</form>
		</div>
	</body>
</html>
